<?php

namespace app\api\controller\courses;

use app\api\controller\Controller;
use app\api\model\courses\Category as CategoryModel;
use app\api\model\WxappCategory as WxappCategoryModel;

/**
 * 专业控制器
 * Class Goods
 * @package app\api\controller
 */
class Category extends Controller
{
    /**
     * 分类页面
     * @return array
     * @throws \think\exception\DbException
     */
    public function index()
    {
        // 专业列表
        $list = array_values(CategoryModel::getCacheTree());
        return $this->renderSuccess(compact( 'list'));
    }

    /**
     * @param $courses_category_id
     * @return array
     */
    public function detail($courses_category_id){
        $detail = (new CategoryModel)->detail($courses_category_id);
        return $this->renderSuccess(compact( 'detail'));
    }

}
